﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace WindowsFormsApplication1.wtyczki
{
    public static class Rotate
    {
        public static Bitmap _270(Bitmap bm)
        {
            Bitmap bmTmp = new Bitmap (bm,bm.Height,bm.Width);
            for (int y = 1; y < bm.Height; y++)
            {
                for (int x = 1; x < bm.Width; x++)
                {
                    bmTmp.SetPixel(y,x, bm.GetPixel(x, y));
                }
            }
            return bmTmp;
        }
        public static Bitmap _90(Bitmap bm)
        {
            Bitmap bmTmp = new Bitmap(bm, bm.Height, bm.Width);
            bmTmp=wtyczki.Flip.horizontal(Rotate._270(bmTmp));
            return bmTmp;
        }
        public static Bitmap _180(Bitmap bm)
        {
            Bitmap bmTmp = new Bitmap(bm);
            for (int y = 1; y < bm.Height; y++)
            {
                for (int x = 1; x < bm.Width; x++)
                {
                    bmTmp.SetPixel(bm.Width-x, bm.Height-y, bm.GetPixel(x, y));
                }
            }
            return bmTmp;
        }
        
    }
}
